package us.norepeter.processing.textmatcher;

import java.util.Properties;

abstract public class Entity extends Properties {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1121257268055596431L;
	public final static String VERSION = "##version##";
	
	public void setProperties(String[] vals) {
		setProperties(getDefaultProps());
	}

	public void setProperties(String[] props, String[] vals) {
		if (props.length != vals.length) {
			StringBuilder msg = new StringBuilder();
			msg.append("Size of property array was not equal to size of value array.");
			msg.append("The default parameters are: ");
			msg.append(getPropString());
			throw new IllegalArgumentException(msg.toString());
		}
		for (int i = 0; i < props.length; i++) {
			setProperty(props[i], vals[i]);
		}
	}

	public abstract String[] getDefaultProps();

	public String getPropString() {
		StringBuilder msg = new StringBuilder();
		String[] defaultProps = getDefaultProps();
		for (int i = 0; i < defaultProps.length; i++) {
			msg.append(defaultProps[i] + " ");
		}
		return msg.toString();
	}
}
